package com.example.demo.service.impl;

import com.example.demo.mapper.CartMapper;
import com.example.demo.pojo.Cart;
import com.example.demo.pojo.Dto.CartDto;
import com.example.demo.service.CartService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;


@Service
public class CartServiceImpl implements CartService {
    @Resource
    private CartMapper cartMapper;
    @Override
    public int insertToCart(int userid, int goodsid, double price, int nums) {
        return cartMapper.insertToCart(userid,goodsid,price,nums);
    }

    @Override
    public List<CartDto> selectAllGoods(int userid) {
        return cartMapper.selectAllGoods(userid);
    }

    @Override
    public Cart selectGoods(int userid, int goodsid) {
        return cartMapper.selectGoods(userid,goodsid);
    }

    @Override
    public int updateGoods(int id,int nums) {
        return cartMapper.updateGoods(id,nums);
    }

    @Override
    public int delGoods(int id) {
        return cartMapper.delGoods(id);
    }

    @Override
    public List<CartDto> queryIds(int[] ids) {
        return cartMapper.queryIds(ids);
    }
}
